package com.ruoyi.bizsys.controller;

import java.util.List;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bizsys.domain.BankAccountLog;
import com.ruoyi.bizsys.service.IBankAccountLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * BankAccountLogController
 *
 * @author african-loan
 * @date 2021-12-28
 */
@RestController
@RequestMapping("/bizsys/bankAccountLog")
public class BankAccountLogController extends BaseController {
    @Autowired
    private IBankAccountLogService bankAccountLogService;

    /**
     * 查询BankAccountLog列表
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(BankAccountLog bankAccountLog) {
        startPage();
        List<BankAccountLog> list = bankAccountLogService.selectBankAccountLogList(bankAccountLog);
        return getDataTable(list);
    }

    /**
     * 导出BankAccountLog列表
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:export')")
    @Log(title = "BankAccountLog", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BankAccountLog bankAccountLog) {
        List<BankAccountLog> list = bankAccountLogService.selectBankAccountLogList(bankAccountLog);
        ExcelUtil<BankAccountLog> util = new ExcelUtil<BankAccountLog>(BankAccountLog.class);
        return util.exportExcel(list, "BankAccountLog");
    }

    /**
     * 获取BankAccountLog详细信息
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(bankAccountLogService.selectBankAccountLogById(id));
    }

    /**
     * 新增BankAccountLog
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:add')")
    @Log(title = "BankAccountLog", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BankAccountLog bankAccountLog) {
        return toAjax(bankAccountLogService.insertBankAccountLog(bankAccountLog));
    }

    /**
     * 修改BankAccountLog
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:edit')")
    @Log(title = "BankAccountLog", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BankAccountLog bankAccountLog) {
        return toAjax(bankAccountLogService.updateBankAccountLog(bankAccountLog));
    }

    /**
     * 删除BankAccountLog
     */
    @PreAuthorize("@ss.hasPermi('bizsys:bankAccountLog:remove')")
    @Log(title = "BankAccountLog", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(bankAccountLogService.deleteBankAccountLogByIds(ids));
    }
}
